import axios from "./request";

// 一个接口封装成一个 函数
//登陆
function user_login(params={}){
    return axios.post('/api/user/login',params)
}
//注册
function user_register(params={}){
    return axios.post('/api/user/register',params)
}
//轮播图
function user_banner(params={}){
    return axios.get('/api/index/banner',{params})
}
//首页导航
function user_nav(params={}){
    return axios.get('/api/index/nav',{params})
}
//首页,秒杀
function user_goodlist(params={}){
    return axios.get('/api/index/goodlist',{params})
}
//一级分类
function user_category(params={}){
    return axios.get('/api/category/list',{params})
}
// 二级分类
function user_subcate(params={}){
    return axios.get('/api/category/subcate',{params})
}
//所有商品页
function user_goods(params={}){
    return axios.get('/api/good/list',{params})
}
//商品详情页
function good_goodinfo(params={}){
    return axios.get('/api/good/goodinfo',{params})
}
//按关键词进行搜索
function good_search(params={}){
    return axios.get('/api/good/search',{params})
}
//收藏
function good_fav(params={}){
    return axios.post('/api/good/fav',params)
}
//收藏列表
function good_favlist(params={}){
    return axios.get('/api/good/favlist',{params})
}
//取消收藏
function good_unfav(params={}){
    return axios.post('/api/good/unfav',params)
}
//购物车列表
function shopcart_list(params={}){
    return axios.get('/api/shopcart/list',{params})
}
//清空购物车
function shopcart_clear(params={}){
    return axios.post('/api/shopcart/clear',params)
}
// 购物车数量加一
function shopcart_add(params={}){
    return axios.post('/api/shopcart/add',params)
}
// 购物车数量减一
function shopcart_sub(params={}){
    return axios.post('/api/shopcart/sub',params)
}



export {
    user_login,
    user_register,
    user_banner,
    user_nav,
    user_goodlist,
    user_category,
    user_subcate,
    user_goods,
    good_goodinfo,
    good_search,
    good_fav,
    good_favlist,
    good_unfav,
    shopcart_list,
    shopcart_clear,
    shopcart_add,
    shopcart_sub

}